import { View } from "../../../mvc/core/View";
import { TweenMax } from "../../../../com/greensock/TweenMax";
import { LayerManager } from "../../manager/LayerManager";
import { ImageNum } from "../common/ImageNum";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { UiHintIconView } from "../uiIconBtn/UiHintIconView";
import { Global } from "../../../../com/gengine/global/Global";
import { GameController } from "../../mvc/GameController";
import { GameUI } from "../mainUI/GameUI";
import { ModuleType } from "../common/ModuleType";
import { TweenLite } from "../../../../com/greensock/TweenLite";
import { 2 } from "../../../../0/2";
type int = number;
//class GuideFightingView
    
    export  class GuideFightingView extends View
    {
        constructor()
        {
            super();
            this.init();
            this.mouseEnabled = false;
            this.mouseChildren = false;
            return;
        }

        public get value(): int
        {
            return this._value;
        }

        public set value(arg1: int)
        {
            this._value = arg1;
            if (this._isLoaded) 
            {
                this._imageNum.updateNum(arg1);
            }
            return;
        }

        public updateValue(arg1: int, arg2: int): void
        {
            this.value = arg1;
            if (this._lastTween) 
            {
                this._lastTween.kill();
            }
            this._lastTween = TweenMax.to(this, 1, {"value": arg2, "onComplete": this.onUpdateComplete});
            return;
        }

        /* internal  */onUpdateComplete(): void
        {
            this.effectArrow();
            return;
        }

        /* internal  */init(): void
        {
            _layer = LayerManager.guideLayer;
            this._fightBitmap = new Object /* flash.display.Bitmap */();
            this.addChild(this._fightBitmap);
            this._imageNum = new ImageNum();
            this._imageNum.x = 130;
            this._imageNum.y = 0;
            this.addChild(this._imageNum);
            LoaderHelp.addResCallBack(ResFileConst.guideFighting, this.onLoadedHandler);
            this.stageResize();
            return;
        }

        /* internal  */onLoadedHandler(): void
        {
            this._fightBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.GuideFighting);
            var loc1=[];
            var loc2=0;
            while (loc2 < 10) 
            {
                loc1.push(GlobalClass.getBitmapData("GuideF" + loc2));
                ++loc2;
            }
            this._imageNum.numBmdArray = loc1;
            this._isLoaded = true;
            return;
        }

        public stageResize(): void
        {
            this.x = UiHintIconView.instance.x;
            this.y = Global.stage.stageHeight - 200;
            return;
        }

        /* internal  */effectArrow(): void
        {
            if (!this._timer) 
            {
                this._timer = new Object /* flash.utils.Timer */(500);
                this._timer.repeatCount = 4;
                this._timer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onTimerCompleteHandler);
            }
            this._timer.reset();
            this._timer.start();
            return;
        }

        /* internal  */onTimerCompleteHandler(arg1: Object /* flash.events.TimerEvent */): void
        {
            this.hide();
            this._timer.stop();
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            this.stageResize();
            this.scaleX = 1;
            this.scaleY = 1;
            super.show();
            return;
        }

        public /* override */ hide(): void
        {
            if (!this._playPoint) 
            {
                this._playPoint = (GameController.gameui.view as GameUI).getNavbarIconGlobalPoint(ModuleType.Players);
                this._playPoint.x = this._playPoint.x - 20;
            }
            TweenLite.to(this, 0.4, {"scaleX": 2, "scaleY": 2});
            TweenMax.to(this, 0.5, {"x": this._playPoint.x, "y": this._playPoint.y, "onComplete": this.closeComplete});
            return;
        }

        /* internal  */closeComplete(): void
        {
            super.hide();
            return;
        }

        /* internal */ /* var */_imageNum: ImageNum;

        /* internal */ /* var */_fightBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_timer: Object /* flash.utils.Timer */;

        /* internal */ /* var */_playPoint: Object /* flash.geom.Point */;

        /* internal */ /* var */_delay: int=1;

        /* internal */ /* var */_value: int;

        /* internal */ /* var */_isLoaded: Boolean;

        /* internal */ /* var */_lastTween: TweenMax;
    }
